package com.le.tester.leetcode;

import io.swagger.models.auth.In;
import org.testng.annotations.IFactoryAnnotation;

/**
 * createTime：2022/5/17 17:26
 * description：2的幂函数
 */
public class TwoExponent {
    public boolean isPowerOfTwo(int n) {
        if (n == 1) {
            return true;
        }
        if (n % 2 != 0) {
            return false;
        }
        if (n == 0) {
            return false;
        }
        return isPowerOfTwo(n / 2);

    }

    public static void main(String[] args) {
        TwoExponent twoExponent = new TwoExponent();
        System.out.println(twoExponent.isPowerOfTwo(0));
    }
}
